ExportReaches Subroutine

private subroutine ExportReaches()

Export reaches on file

Arguments

None

Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: fileunit

Source Code

SUBROUTINE ExportReaches &
!
( )

IMPLICIT NONE

!local declaration:
INTEGER ( KIND = short ) :: fileunit

!-----------------------end of declaration-------------------------------------

fileunit = GetUnit ()

OPEN (unit = fileunit, file = 'stream_network.txt' )

WRITE (fileunit, '(a)') 'surface_routing_reaches'
WRITE (fileunit, '(a)') '          ID          X0            Y0             &
                            X1             Y1                CELLS     STHRALER_ORDER   &
                            SLOPE_L/L        LENGTH_m       DRAINED_CELLS   '

!scan all list elements
current => list
DO 

    WRITE(fileunit, '(I,3X,E,E,E,E,I,I,10x,E,1X,E,1X,E,I,11X,E,1X,E,&
                        1X,E,1X,E,1X,E,5X,E,E,E)') &
                        current % id, current % x0, current % y0, &
                        current % x1, current % y1, current % n_cells, &
                        current % order, current % slope, current % length,  &
                        current % area 
                            
                            
    IF ( .NOT. ASSOCIATED (current % next) ) THEN !found last element of list
    EXIT
    END IF

    current => current % next

END DO

CLOSE (fileunit)



END SUBROUTINE ExportReaches